package com.comp6231.replica3.common;
public class EnumHelper {

	/**
	 * converts a numerical status to its corresponding Enum value
	 * 
	 * @param numStatus
	 * @return
	 */
	public static RecordStatus convertToRecordStatus(int numStatus) {

		if (numStatus == RecordStatus.Captured.ordinal()) {
			return RecordStatus.Captured;
		}
		
		if (numStatus == RecordStatus.Found.ordinal()) {
			return RecordStatus.Found;
		}
		
		if (numStatus == RecordStatus.Missing.ordinal()) {
			return RecordStatus.Missing;
		}
		
		if (numStatus == RecordStatus.OnTheRun.ordinal()) {
			return RecordStatus.OnTheRun;
		}
		
		return null;
	}
	
	/**
	 * converts a numerical record type to its correcponding Enum
	 * @param recType
	 * @return
	 */
	public static RecordType convertToRecordType(int recType) {
		if (recType == RecordType.Criminal.ordinal()) {
			return RecordType.Criminal;
		}
		
		if (recType == RecordType.Missing.ordinal()) {
			return RecordType.Missing;
		}
		
		return null;
	}
}
